package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.query.QueryObject;
import cn.wolfcode.luowowo.util.TravelCondition;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject {

    private Long destId = -1L; // 目的地编号
    private int state = 2; // 默认是已发布的
    private int isPublic = 1; // 默认是公开的

    private int dayType = -1;

    // 如果等于 1 根据创建时间排序, 否则根据根据点击量排序
    private int orderType = 1;

    public String getOrderBy() {
        return orderType == 1 ? "t.createTime desc" : "t.viewnum desc";
    }

    public TravelCondition getDays() {
        return TravelCondition.DAY_TYPE.get(dayType);
    }

    private int perExpendType = -1;

    public TravelCondition getPerExpend() {
        return TravelCondition.PER_EXPEND_TYPE.get(perExpendType);
    }

    private int travelTimeType = -1;

    public TravelCondition getTravelTime() {
        return TravelCondition.TRAVEL_TIME_TYPE.get(travelTimeType);
    }

}
